/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Juan
 */
@Entity
@Table(name = "fecha")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Fecha.findAll", query = "SELECT f FROM Fecha f"),
    @NamedQuery(name = "Fecha.findById", query = "SELECT f FROM Fecha f WHERE f.id = :id"),
    @NamedQuery(name = "Fecha.findByDate", query = "SELECT f FROM Fecha f WHERE f.date = :date"),
    @NamedQuery(name = "Fecha.findByMonth", query = "SELECT f FROM Fecha f WHERE f.month = :month"),
    @NamedQuery(name = "Fecha.findByYear", query = "SELECT f FROM Fecha f WHERE f.year = :year")})
public class Fecha implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Long id;
    @Basic(optional = false)
    @Column(name = "date")
    private int date;
    @Basic(optional = false)
    @Column(name = "month")
    private int month;
    @Basic(optional = false)
    @Column(name = "year")
    private int year;
    @OneToMany(mappedBy = "iddate")
    private Collection<Quote> quoteCollection;

    public Fecha() {
    }

    public Fecha(Long id) {
        this.id = id;
    }

    public Fecha(Long id, int date, int month, int year) {
        this.id = id;
        this.date = date;
        this.month = month;
        this.year = year;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public int getDate() {
        return date;
    }

    public void setDate(int date) {
        this.date = date;
    }

    public int getMonth() {
        return month;
    }

    public void setMonth(int month) {
        this.month = month;
    }

    public int getYear() {
        return year;
    }

    public void setYear(int year) {
        this.year = year;
    }

    @XmlTransient
    public Collection<Quote> getQuoteCollection() {
        return quoteCollection;
    }

    public void setQuoteCollection(Collection<Quote> quoteCollection) {
        this.quoteCollection = quoteCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Fecha)) {
            return false;
        }
        Fecha other = (Fecha) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "dataacces.Fecha[ id=" + id + " ]";
    }
    
}
